import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

import javax.servlet.annotation.WebServlet;
import java.util.HashMap;

public class One {
    //puppyAge 是公有的实例变量
    int puppyAge;
    //salary是静态的私有变量
    private static int salary;
    // DEPARTMENT是一个常量
    public static final String DEPARTMENT = "开发人员";
    public One(int id) {
        puppyAge = 1;
        salary = 1;
        int a,b,c;
//        System.out.print(id);
//        one1();
    }

    public static void one1() {
        //静态方法，使用 实例变量 puppyAge，必须 new 当前实例
        One oneModel = new One(2);
        oneModel.puppyAge = 2;
        byte salary = (byte)2;
        int i =128;
        byte b = (byte)i;
        HashMap<String, Byte> Sites = new HashMap<>();
        Sites.put("b", b);
        Sites.put("salary", salary);
        System.out.print(Sites);

    }

    public void one2() {
        //非静态方法，可直接使用 puppyAge
        puppyAge = 3;
        salary = 3;
    }

    public static void main(String[] args) throws InterruptedException {
//        System.out.print(22);
        One oneModel = new One(4);
        oneModel.puppyAge = 4;
        salary = 4;
//        oneModel.one1();
//        System.exit(0);

        System.setProperty("webdriver.gecko.driver", "D:\\Firefox\\geckodriver.exe");
        WebDriver driver = new FirefoxDriver();
        driver.manage().window().maximize();
        driver.get("https://www.baidu.com/");
        driver.findElement(By.name("wd")).sendKeys(new CharSequence[]{"自动化测试"});
        Thread.sleep(500L);
        driver.findElement(By.id("su")).click();
        Thread.sleep(500L);
        driver.quit();
    }
}
